<?php
require_once dirname(dirname(__FILE__)) . '/config/config.php';
require_once DOCUMENT_ROOT . DIR_SHARED_DAO . "dao_buy_doc.php";
require_once DOCUMENT_ROOT . DIR_SHARED_DAO . "dao_buy_status.php";
require_once DOCUMENT_ROOT . DIR_SHARED_LIBRARIES . 'lib_redirect.php';

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of api_security
 *
 * @author Thien
 */
class api_cart {
    
    public static function remove_doc_id_from_cart($doc_id, $cart_key) {
        if (!empty($_SESSION[$cart_key]) && count($_SESSION[$cart_key]) > 0) {
            $list = $_SESSION[$cart_key];
            foreach ($list as $num => $item) {
                if ($item == $doc_id) {
                    unset($list[$num]);
                }
            }
            $_SESSION[$cart_key] = $list;
        }
        return TRUE;
    }
    
}
